#include<stdio.h>
int pd[32]={0,31,28,31,30,31,30,31,31,30,31,30,31};
struct  Date{
    int yy;
    int mm;
    int dd;
};
typedef struct Date Date;
int prn(int x){
    if ((x % 4 == 0 && x % 100 != 0) || (x % 400 == 0)) {
        return 1;
    } else {
        return 0;   
    }
}
int checkdate(Date date){
    if(date.yy<=0 || date.mm<=0 || date.dd<=0)return 0;
    if(date.mm!=2&&date.dd<=pd[date.mm])return 1;
    if(date.mm==2&prn(date.yy)==1&&date.dd<=29)return 1;
    if(date.mm==2&prn(date.yy)==0&&date.dd<=28)return 1;
    return 0;
}
int main(){
    Date in;
    scanf("%d%d%d",&in.yy,&in.mm,&in.dd);
    if(checkdate(in)==1)printf("true\n");
    else printf("false\n");
    return 0;
}